//写一个泛型类，求其中的最大值
class Alg3<E extends Comparable<E>>{
    public E findMax(E[] arrays){
        E max=arrays[0];
        for (int i = 0; i <arrays.length ; i++) {
            if(max.compareTo(arrays[i])<0){
                max=arrays[i];
            }
        }
        return max;

    }
}
class Alg2{
    public static <E extends Comparable<E>> E findMax(E[] arrays){
        E max=arrays[0];
        for (int i = 0; i <arrays.length ; i++) {
            if(max.compareTo(arrays[i])<0){
                max=arrays[i];
            }
        }
        return max;
    }
}
public class Test3 {
    public static void main(String[] args) {
        Integer[] a={1,2,3,4,5,6};
        int s=Alg2.findMax(a);
        System.out.println(s);
    }
    public static void main1(String[] args) {
        Integer[] a={1,2,3,4,5,6};
        Alg3<Integer> alg3=new Alg3<>();
        int s=alg3.findMax(a);
        System.out.println(s);
    }
}
